<?php $skin_url = $this->APP_STATIC_SERVER . '/skins/'. $this->APP_TEMPLATE . '/'. $this->APP_SKIN;?>
<?php if($this->enterprise && count($this->infos) >= 4): ?>
<div class="subcolumns tabs pb10">
    <ul class="tabNavigation">
        <?php for($i = 0; $i < count($this->infos); $i++): ?>
            <?php if(!$this->permission || $this->permission->enterprise_info[$i] == 1   || $this->permission_viewall == 1) :?>
            	<?php //if($this->infos[$i]->info_string!=""):?>
            	<li>
            		<a href="#info<?php echo $i; ?>" <?php if($i == 0):?>class="selected"<?php endif;?>>
            			<?php echo $this->infos[$i]->info_title; ?>
            		</a>
            	</li>
            	<?php //endif;?>
            <?php endif; ?>
        <?php endfor; ?>
    </ul>
    <?php for($i = 0; $i < count($this->infos); $i++): ?>
        <?php if(!$this->permission || $this->permission->enterprise_info[$i] == 1  || $this->permission_viewall == 1) :?>
        <div id="info<?php echo $i; ?>" <?php if($i == 0):?>style="display: block;"<?php else: ?>style="display: none"<?php endif;?>>
            <h2>
                <?php if($this->user_entity == 0): ?>
                <?php
                    $arrRouteInfo = array(
                        'enterprise_id' => $this->enterprise->id,
                        'enterprise_name' => Tomato_Utility_String::removeSign($this->enterprise->company_name_en, '-', true),
                        'info_id' => $this->infos[$i]->info_id
                    );
                ?>
                <a href="<?php echo $this->url($arrRouteInfo, 'bizprofile_user_edit_enterprise_info'); ?>"><img src="<?php echo $skin_url; ?>/images/edit.png" /></a>
                <?php endif; ?>
            </h2>
            <p>
                <?php if($this->infos[$i] && $this->infos[$i]->info_string == "" && $this->lang == 'en_US' && $this->vi_infos[$i] != ""): ?>
                    <span class="translate"><a title="<?php echo $this->translator()->widget('translate_to_english'); ?>" rel="<?php echo $i; ?>" id="translate"  href="javascript:void(0)">Translate</a>
                    <span id="content_<?php echo $i; ?>"><?php echo $this->vi_infos[$i]->info_string; ?></span>
                <?php else: ?>
                    <?php echo $this->infos[$i]->info_string; ?>
                <?php endif;?>
            </p>
        </div>
        <?php endif; ?>
    <?php endfor; ?>
</div>
<script src="<?php echo $this->APP_STATIC_SERVER; ?>/skins/default/html/yaml/core/js/webkit-focusfix.js" type="text/javascript"></script>
<script src="<?php echo $this->APP_STATIC_SERVER; ?>/skins/bizprofile/default/html/js/jquery.translate.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
    function translateText(response) {
        console.log(response.data.translations[0].translatedText);
        //document.getElementById('content_0').innerHTML += "<br>" + response.data.translations[0].translatedText;
        $("#content_" + 0).html(response.data.translations[0].translatedText);
    }

   $(function () {
       var tabContainers = $('div.tabs > div');
       tabContainers.hide().filter(':first').show();
		/* Khanh : auto translate*/
        $(".translate a").click(function(){
			var element = $(this);
            var rel = element.attr("rel");
            $("#info" + rel).translate('en');
        })

       $('div.tabs ul.tabNavigation a').click(function () {
               tabContainers.hide();
               tabContainers.filter(this.hash).show();
               $('div.tabs ul.tabNavigation a').removeClass('selected');
               $(this).addClass('selected');
               return false;
       }).filter(':first').click();
   });
	
</script>
                       	
<?php endif; ?>
